package com.ruoci.redis.config;

import com.ruoci.redis.response.BasicResponse;
import com.ruoci.redis.response.ResponseCode;
import lombok.extern.slf4j.Slf4j;

import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author yang
 * 全局异常处理
 **/
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(BusinessException.class)
    public BasicResponse systemExceptionHandler(BusinessException e) {
        return BasicResponse.fail(e.getErrorCode(), e.getErrorMsg());
    }

}
